home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / ICNDRW_1.ARJ / DRAGICON.PAS < prev    next >
Pascal/Delphi Source File  |  1991-08-20  |  3KB  |  101 lines

  1. {---------------------------------------------------------------------
  2.      Drag Icon
  3.  
  4.      Copyright (c) 1991 - SofDesign Technology
  5.      All Rights Reserved
  6.  
  7.      This program demostrates the icon drag feature.
  8.  
  9.      To use, type
  10.  
  11.      DRAGICON libname iconname
  12.  
  13.      if libname is not specified, then an icon name is assumed.
  14.  
  15.      note: you must use the file extensions on the libname and
  16.      the iconname.
  17.  
  18.  ---------------------------------------------------------------------}
  19. program Drag_Icon;
  20.  
  21. {$X+}
  22. {$G+}
  23. {$R-}
  24. {$S-}
  25. uses crt,mouse,bgidriv,graph,icontool;
  26. var
  27.   graphdriver,graphmode : integer;
  28.   anicon:icon;
  29.  
  30. procedure main;
  31. var i:integer;
  32.     mx,my,b:word;
  33.     k:char;
  34.     showtitle:boolean;
  35. begin
  36.   if paramcount=1 then
  37.     anicon.init('',paramstr(1),20,20)
  38.   else
  39.   if paramcount>1 then
  40.     anicon.init(paramstr(1),paramstr(2),20,20);
  41.   if not anicon.initerror then
  42.   begin
  43.     showtitle:=false;
  44.     rectangle(0,10,getmaxx,getmaxy-10);
  45.     setfillstyle(solidfill,getmaxcolor);
  46.     bar((getmaxx div 2)-100,getmaxy div 2 - 10,getmaxx div 2 + 100,getmaxy div 2 + 10);
  47.     outtextxy(1,1,'ICON DRAG.  Left Button picks icon up, Right Button or ''Q'' quits');
  48.     outtextxy(1,getmaxy-9,'Copyright (c) 1991 - SofDesign Technology - All Rights Reserved');
  49.     anicon.setput(copyput);
  50.     anicon.icontitle(showtitle);
  51.     anicon.showicon;
  52.     anicon.setboundaries(1,10,getmaxx-1,getmaxy-10);
  53.  
  54.     driverinstalled;
  55.     resetmouse;
  56.     setmouse(getmaxx div 2, getmaxy div 2);
  57.     showmouse;
  58.     repeat
  59.       getmouse(mx,my,b);
  60.       if keypressed then
  61.       begin
  62.         k:=upcase(readkey);
  63.         if k='T' then
  64.         begin
  65.           hidemouse;
  66.           anicon.hideicon;
  67.           showtitle:=not showtitle;
  68.           anicon.icontitle(showtitle);
  69.           anicon.showicon;
  70.           showmouse;
  71.         end;
  72.       end;
  73.       if anicon.inbounds(mx,my) then
  74.       begin
  75.         if b=1 then
  76.         begin
  77.           anicon.setput(orput);
  78.           anicon.mousedragicon(1);
  79.           hidemouse;
  80.           anicon.hideicon;
  81.           anicon.setput(copyput);
  82.           anicon.showicon;
  83.           showmouse;
  84.         end;
  85.       end;
  86.     until (k='Q') or (b=2);
  87.     hidemouse;
  88.   end;
  89.   closegraph;
  90. end;
  91.  
  92. begin
  93.   RegisterBGIdriver(@CGADriverProc);
  94.   RegisterBGIdriver(@EGAVGADriverProc);
  95.   RegisterBGIdriver(@HercDriverProc);
  96.   RegisterBGIdriver(@ATTDriverProc);
  97.   RegisterBGIdriver(@PC3270DriverProc);
  98.   detectgraph(graphdriver,graphmode);
  99.   initgraph(graphdriver,graphmode,'');
  100.   main;
  101. end.